/* ========================================
   响应式设计增强
   ======================================== */

/* 基础响应式断点 */
/* 
  sm: 640px
  md: 768px  
  lg: 1024px
  xl: 1280px
  2xl: 1536px
*/

/* 容器最大宽度 */
.container-responsive {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container-responsive {
    max-width: 640px;
    padding: 0 1.5rem;
  }
}

@media (min-width: 768px) {
  .container-responsive {
    max-width: 768px;
    padding: 0 2rem;
  }
}

@media (min-width: 1024px) {
  .container-responsive {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container-responsive {
    max-width: 1280px;
  }
}

/* 移动端优化 */
@media (max-width: 640px) {
  /* 卡片间距优化 */
  .card-mobile {
    margin: 0.75rem;
    padding: 1rem;
    border-radius: 1rem;
  }

  /* 按钮尺寸优化 */
  .btn-mobile {
    min-height: 44px; /* iOS 推荐的最小触摸目标 */
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  /* 输入框优化 */
  .input-mobile {
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  /* 导航栏优化 */
  .nav-mobile {
    padding: 0.5rem;
    min-height: 60px;
  }

  /* 文本大小调整 */
  .text-mobile-sm {
    font-size: 0.875rem;
  }

  .text-mobile-base {
    font-size: 1rem;
  }

  .text-mobile-lg {
    font-size: 1.125rem;
  }

  .text-mobile-xl {
    font-size: 1.25rem;
  }

  /* 间距调整 */
  .spacing-mobile-tight {
    gap: 0.5rem;
  }

  .spacing-mobile-normal {
    gap: 0.75rem;
  }

  .spacing-mobile-loose {
    gap: 1rem;
  }
}

/* 平板端优化 */
@media (min-width: 641px) and (max-width: 1024px) {
  .tablet-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .tablet-sidebar {
    width: 280px;
  }

  .tablet-main {
    flex: 1;
    min-width: 0;
  }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
  .desktop-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
  }

  .desktop-sidebar {
    width: 320px;
  }

  .desktop-main {
    flex: 1;
    min-width: 0;
  }

  /* 多列布局 */
  .desktop-columns-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .desktop-columns-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* 看板响应式 */
.kanban-responsive {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding: 1rem;
}

@media (max-width: 640px) {
  .kanban-responsive {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .kanban-column-mobile {
    min-width: 280px;
    flex-shrink: 0;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .kanban-column-tablet {
    min-width: 320px;
    flex-shrink: 0;
  }
}

@media (min-width: 1025px) {
  .kanban-responsive {
    overflow-x: visible;
  }

  .kanban-column-desktop {
    flex: 1;
    min-width: 300px;
  }
}

/* 模态框响应式 */
.modal-responsive {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content-responsive {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .modal-responsive {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content-responsive {
    border-radius: 1rem 1rem 0 0;
    max-height: 85vh;
  }
}

/* 表格响应式 */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .table-mobile-stack {
    display: block;
  }

  .table-mobile-stack thead {
    display: none;
  }

  .table-mobile-stack tbody,
  .table-mobile-stack tr,
  .table-mobile-stack td {
    display: block;
  }

  .table-mobile-stack tr {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .table-mobile-stack td {
    border: none;
    padding: 0.5rem 0;
    position: relative;
    padding-left: 30%;
  }

  .table-mobile-stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 25%;
    font-weight: 600;
    color: #374151;
  }
}

/* 图片响应式 */
.img-responsive {
  max-width: 100%;
  height: auto;
}

/* 视频响应式 */
.video-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 文字响应式 */
.text-responsive {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  line-height: 1.6;
}

.heading-responsive {
  font-size: clamp(1.25rem, 4vw, 2rem);
  line-height: 1.2;
}

/* 网格响应式 */
.grid-responsive {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1280px) {
  .grid-responsive {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }
}

/* 导航响应式 */
.nav-responsive {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

@media (max-width: 640px) {
  .nav-responsive {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .nav-mobile-menu.open {
    transform: translateX(0);
  }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
  .touch-optimized {
    min-height: 44px;
    min-width: 44px;
  }

  /* 禁用hover效果 */
  .no-touch-hover:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .high-contrast {
    border: 2px solid;
  }

  .high-contrast-text {
    font-weight: 600;
  }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
  .respect-motion-preference * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印样式 */
@media print {
  .print-hidden {
    display: none !important;
  }

  .print-visible {
    display: block !important;
  }

  .print-page-break {
    page-break-before: always;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
